#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[10010],wz[10010],ans[10010];
void In(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		wz[i]=i;
		ans[i]=i;
	}
}
void Work(){
	for(int i=1;i<=n;i++){
		for(int j=i;j>=2;j--){
			if(a[j]<a[j-1]){
				swap(a[j],a[j-1]);
				swap(ans[wz[j]],ans[wz[j-1]]);
				swap(wz[j],wz[j-1]);
			}
		}
	}
	while(m--){
		int t1,t2,t3;
		scanf("%d",&t1);
		if(t1==2){
			scanf("%d",&t2);
			printf("%d\n",ans[t2]);
		}else{
			scanf("%d%d",&t2,&t3);
			t2=ans[t2];
			if(t3<a[t2]){
				a[t2]=t3;
				for(int i=t2;i>=2;i--){
					if(a[i]<a[i-1]){
						swap(a[i],a[i-1]);
						swap(ans[wz[i]],ans[wz[i-1]]);
						swap(wz[i],wz[i-1]);
					}else if(a[i]==a[i-1]&&wz[i]<wz[i-1]){
						swap(a[i],a[i-1]);
						swap(ans[wz[i]],ans[wz[i-1]]);
						swap(wz[i],wz[i-1]);
					}
				}
			}else if(t3>a[t2]){
				a[t2]=t3;
				for(int i=t2;i<n;i++){
//					cout<<i<<" "<<a[i]<<" "<<a[i+1]<<" "<<wz[i]<<" "<<wz[i+1]<<endl;
					if(a[i]>a[i+1]){
						swap(a[i],a[i+1]);
						swap(ans[wz[i]],ans[wz[i+1]]);
						swap(wz[i],wz[i+1]);
					}else if(a[i]==a[i+1]&&wz[i]>wz[i+1]){
						swap(a[i],a[i+1]);
						swap(ans[wz[i]],ans[wz[i+1]]);
						swap(wz[i],wz[i+1]);
					}
				}
			}
		}
	}
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	In();
	Work();
	return 0;
}

